package com.example.bbs.web.servlet; /**
 * @auther: zhangxin
 * @Description:
 */

import com.example.bbs.model.Block;
import com.example.bbs.service.BlockService;
import com.example.bbs.service.impl.BlockServiceImpl;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.List;

@WebServlet(name = "BlockServlet", value = "/bbs/getBlocks")
public class BlockServlet extends HttpServlet {

    BlockService blockService = new BlockServiceImpl();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("UTF-8");
        List<Block> blocks = blockService.findBlockAll();
        req.setAttribute("blocks",blocks);
        req.getRequestDispatcher("/boards.jsp").forward(req,resp);
    }
}
